home *** CD-ROM | disk | FTP | other *** search
Text File | 1997-06-28 | 744 b | 37 lines | [TEXT/CWIE] |
- // FiniteStackBase.h
-
- #ifndef FiniteStackBase_h
- #define FiniteStackBase_h
-
- #ifndef Integers_h
- #include "Integers.h"
- #endif
-
- class FiniteStackBase
- {
- private:
- uint8 *const start;
- uint8 *const end;
- const uint32 elementSize;
-
- uint8 *allocateNext;
-
- // not implemented:
- FiniteStackBase( const FiniteStackBase& );
- void operator=( const FiniteStackBase& );
-
- public:
- FiniteStackBase( void *theSpace, uint32 length, uint32 elementSize );
-
- bool Full() const { return allocateNext >= end; }
- bool IsEmpty() const { return allocateNext <= start; }
-
- void *Allocate( uint32 size );
- void Release( void * );
- };
-
- inline void *operator new( uint32 size, FiniteStackBase& pool )
- { return pool.Allocate( size ); }
-
- #endif
-